package com.yesorno.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextPaint;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * 信息中的私信的菜单
 * 
 * @author samoin
 * @version 0.1
 * @since 2011-08-08
 * 
 */
public class PersonalMessageMenuActivity extends Activity {

	private RelativeLayout personal_message_menu_recall;
	private RelativeLayout personal_message_menu_del;
	private RelativeLayout personal_message_menu_delall;
	private RelativeLayout personal_message_menu_copy;

	private long currentMessageId = 0;
	private long currentUserId = 0;
	private int selectIndex = 0;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.personal_message_menu);

		TextView hall_menu_title = (TextView) findViewById(R.id.message_menu_title);
		TextPaint tp = hall_menu_title.getPaint();
		tp.setFakeBoldText(true);

		personal_message_menu_recall = (RelativeLayout) findViewById(R.id.personal_message_menu_recall);
		personal_message_menu_del = (RelativeLayout) findViewById(R.id.personal_message_menu_del);
		personal_message_menu_delall = (RelativeLayout) findViewById(R.id.personal_message_menu_delall);
		personal_message_menu_copy = (RelativeLayout) findViewById(R.id.personal_message_menu_copy);
		MyOnClickListener mocl = new MyOnClickListener();
		personal_message_menu_recall.setOnClickListener(mocl);
		personal_message_menu_del.setOnClickListener(mocl);
		personal_message_menu_delall.setOnClickListener(mocl);
		personal_message_menu_copy.setOnClickListener(mocl);
		Intent intent = getIntent();

		currentMessageId = intent.getLongExtra("currentMessageId", 0);
		currentUserId = intent.getLongExtra("currentUserId", 0);
		selectIndex = intent.getIntExtra("selectIndex", 0);
	}

	class MyOnClickListener implements OnClickListener {

		@Override
		public void onClick(View v) {
			if (v == personal_message_menu_recall) {
				Intent intent = new Intent();
				intent.putExtra("currentUserId", currentUserId);
				intent.putExtra("currentMessageId", currentMessageId);
				intent.setClass(PersonalMessageMenuActivity.this,
						PersonalMessageRecallActivity.class);
				startActivity(intent);
			}
			if (v == personal_message_menu_del) {
				// TODO 这里将来要与后台通讯，删除相关信息
				Intent intent = new Intent();
				intent.putExtra("type", "del");
				intent.putExtra("selectIndexGroup", selectIndex + "");
				PersonalMessageMenuActivity.this.setResult(RESULT_OK, intent);
				PersonalMessageMenuActivity.this.finish();
			}
			if (v == personal_message_menu_delall) {
				// TODO 这里将来要与后台通讯，删除相关信息
				String delIndexGroup = "0,1";
				Intent intent = new Intent();
				intent.putExtra("type", "delall");
				intent.putExtra("selectIndexGroup", delIndexGroup);
				PersonalMessageMenuActivity.this.setResult(RESULT_OK, intent);
				PersonalMessageMenuActivity.this.finish();
			}
			if (v == personal_message_menu_copy) {
			}
		}

	}

}
